package com.bigshen.demo.annotation.configurecomponents.a4Conditional;

import com.bigshen.demo.project.entity.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfig {

    @Conditional(WindowCondition.class)
    @Bean
    public Person shen() {
        System.out.println("将shen添加到ioc容器中");
        return new Person("Shen", "18");
    }

    @Bean
    @Conditional(LinuxCondition.class)
    public Person liu() {
        System.out.println("将liu添加到ioc容器中");
        return new Person("liu", "18");
    }

    @Bean
    @Conditional(WindowCondition.class)
    public Person wang() {
        System.out.println("将wang添加到ioc容器中");
        return new Person("wang", "18");
    }

}
